/**
 * Created by tom on 2017/3/10.
 */
'use strict';

var util = require('util');
var mysql = require('mysql2');

var enrollSql = "insert into con_enroll(guest_name, nationality, institutions, position, industry, " +
  "email, contact, wechat, govt_id, present_date, source, referees, ticket_type, ticket_no, ticket_cost, " +
  "vip_ticket_type, vip_ticket_no, vip_ticket_cost, detail, create_time) " +
  "values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, now())";

var getUserByIdSql = "select id, user_name, password from user where id = ?";

async function getUserById(params) {
  var formatSql = mysql.format(getUserByIdSql, params);
  console.log(formatSql);
  var result = await global.ppool.queryAsync(formatSql);
  console.log(result);
  return result;
}

module.exports.getUserById = getUserById;
